﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.IO;

namespace Delta
{
    class IniFile
    {
        //DllImport：引入kernel32.dll这个动态连接库
        [DllImport("kernel32")]
        public static extern long WritePrivateProfileString(string section, string key, string val, string filePath);

        [DllImport("kernel32")]
        public static extern int GetPrivateProfileString(string section, string key, string defVal, StringBuilder retVal, int size, string filePath);

        public static void DeleteSetting(string section, string key, string filePath)
        {
            //private long i; 
            //  i = WritePrivateProfileString(section, key, null, filePath);
            WritePrivateProfileString(section, key, null, filePath);

        }

        public static void SaveSetting(string section, string key, string value,string filePath)
        {
            //private long i; 
            //  i = WritePrivateProfileString(section, key, null, filePath);
            WritePrivateProfileString(section, key, value, filePath);

        }
    }
    
}
